package kr.co.sdworld.webclient.spring.controller;

import kr.co.sdworld.api.apns.service.PushService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class CT_Push 
{
	@Autowired
	private PushService pushService;
	
	@RequestMapping("/push.sd")
	public ModelAndView push(
			@RequestParam(value="appId") String appId,
			@RequestParam(value="deviceToken") String deviceToken,
			@RequestParam(value="message")String message, 
			@RequestParam(value="sound") String sound)
	{
		ModelAndView mnv = new ModelAndView("jsonView");
		pushService.push( deviceToken, appId, message, sound);
		mnv.addObject("result", "success");
		return mnv;
	}
}
